<?php

declare (strict_types=1);
namespace App\Model;


/**
 * @property int $id 
 * @property int $shop_id 商铺id
 * @property string $coupon_name 优惠券名
 * @property string $send_begin_time 发放开始时间
 * @property string $send_end_time 发放结束时间
 * @property string $use_begin_time 有效期b
 * @property string $use_end_time 有效期e
 * @property int $bind_user_type 1全部 2新 3老 4指定用户
 * @property string $min_limit 满xx
 * @property string $price 面额
 * @property int $status 发放状态0待发放 1已发放 2作废
 * @property int $is_send 1用户可领  0不可领取 仅后台发放
 * @property int $send_num 已发放数量
 * @property int $total_num 总库存数量
 * @property int $use_num 已使用数量
 * @property string $tips 优惠券描述
 * @property int $last_num 剩余优惠券数量
 * @property string $send_time 发放时间
 */
class FlyCoupon extends CloudBase
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'fly_coupon';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [];
    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = ['id' => 'string', 'shop_id' => 'string', 'bind_user_type' => 'integer', 'status' => 'integer',
        'is_send' => 'integer', 'send_num' => 'integer', 'total_num' => 'integer',
        'use_num' => 'integer',
        'update_by' => 'string',
        'create_by' => 'string',
        'delete_by' => 'string',
        'last_num' => 'integer'];

    public function link_product(){
        return $this->hasMany(FlyCouponGood::class,'coupon_id','id')->with('product_info');
    }
}